import request from '@/utils/request'

var baseUrl = '/sys-user'

export function login(data) {
  return request({
    url: baseUrl + '/login',
    method: 'post',
    data
  })
}
export function changePassword(data) {
  return request({
    url: baseUrl + '/change_password',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: baseUrl + '/info',
    method: 'get',
    params: { token }
  })
}

export function getUserInfo(token) {
  return request({
    url: baseUrl + '/user-info',
    method: 'get',
    params: { token }
  })
}

export function getById(id) {
  return request({
    url: baseUrl + '/get-by-id',
    method: 'get',
    params: { id }
  })
}

export function logout() {
  return request({
    url: baseUrl + '/logout',
    method: 'post'
  })
}

export function fetchList(query) {
  return request({
    url: baseUrl + '/get-list-page',
    method: 'post',
    data: query
  })
}

export function createSysUser(data) {
  return request({
    url: baseUrl + '/save',
    method: 'post',
    data
  })
}

export function updateSysUser(data) {
  return request({
    url: baseUrl + '/update',
    method: 'post',
    data
  })
}

export function deleteOneSysUser(id) {
  return request({
    url: baseUrl + '/delete-one',
    method: 'get',
    params: { id }
  })
}

